<#assign module="marketing"/>

<@override name="header">
<link rel="stylesheet" href="${ctx}/assets/css/bootstrap-multiselect.css">
<link rel="stylesheet" href="${ctx}/assets/css/datetimepicker.css">
<link rel="stylesheet" href="${ctx}/assets/css/phonegift.css">
<link rel="stylesheet" href="${ctx}/assets/css/jquery.minicolors.css">
</@override>
<@override name="body">

	<div class="row">
		<div class="col-md-12">
			<div class="panel panel-default">
				<div class="panel-heading">
					编辑输入手机号赠送优惠券活动
					<label class="control-label"><font color="red">（带*表示必填项）</font></label>
			    </div>
			    <div class="panel-body">
			    	<div class="col-sm-3">
						<div class="swiper-container">
						    <div class="page" id="backage_color" style="background-color:${activity.backgroudColor};background-size:100% 100%;">
						    	<img class="bgImage" id="image" src="${ctx}/${activity.activityImage}" alt="bg_1"/>
						    	<div class="master">
						    		<input type="text" class="fomtor" placeholder="请输入手机号码"/>
						    		<button type="button" class="pabutton">确认领取</button>
						    	</div>
						    	<div style="color:#ffffff;text-align:center">
						    		<h4>活动规则</h4>
						    	</div>
						    	<div class="content" id="contentBody" >
									<p>${activity.activityContent?if_exists}
						    	</div>
						    </div>
						</div>
			    	</div>
			    
			    
			    <div class="col-sm-9">
    				<form id="submit_form" action="${ctx}/activity/update" class="form-horizontal" method="post">
    					<input type="hidden" name="id" value="${activity.id}">
		               	<input type="hidden" id="activityEvent" name="activityEvent" value="phoneGift" />
		               	<input type="hidden" id="activityType" value="${activity.activityType}" />
		               	<@shiro.isMainCompany>
		               		<div class="form-group">
			                    <label class="col-sm-3 control-label"><em>*</em>所属公司：</label>
			                    <div class="col-sm-3">
			                    	<input type="hidden" id="companyNames" name="companyNames" value="" />
			                    	<select class="form-control" id="companyIds" name="companyIds" multiple="multiple" required>
			                    		<#if companys??>
			                    			<#list companys as company>
			                    				<option value="${company.id}" <#if activity.companyIds?contains(','+company.id+',')>selected="selected"</#if>>${company.abbreviation?if_exists}</option>
			                    			</#list>
			                    		</#if>
			                    	</select>
			                    </div>
			                </div>
		               	</@shiro.isMainCompany>
		               	
		               	<div class="form-group">
		                    <label class="col-sm-3 control-label">客户等级：</label>
		                    <div class="col-sm-3">
		                    	<input type="hidden" id="gradeNames" name="gradeNames" value="" />
		                    	<select class="form-control" id="gradeIds" name="gradeIds" multiple="multiple" required>
		                    		<#if grades??>
		                    			<#list grades as grade>
		                    				<option value="${grade.id}" <#if activity.gradeIds??><#if activity.gradeIds?contains(','+grade.id+',')>selected="selected"</#if></#if>>${grade.name?if_exists}</option>
		                    			</#list>
		                    		</#if>
		                    	</select>
		                    </div>
		                </div>
		               
		                <div class="form-group">
		                    <label class="col-sm-3 control-label"><em>*</em>客户类型：</label>
		                    <div class="col-sm-3">
		                    	<select class="form-control" id="activityTarget" name="activityTarget" required>
		                    		<option value="all" <#if activity.activityTarget=='all'>selected="selected"</#if>>所有客户</option>
		                    		<option value="passenger" <#if activity.activityTarget=='passenger'>selected="selected"</#if>>个人客户</option>
		                    		<option value="enterprise" <#if activity.activityTarget=='enterprise'>selected="selected"</#if>>企业客户</option>
		                    	</select>
		                    </div>
		                </div>
		                
		                
		                
		               
		                <div class="form-group">
		                    <label class="col-sm-3 control-label"><em>*</em>活动类型：</label>
		                    <div class="col-sm-3">
		                    	<p class="form-control-static">
			                    	<#if activity.activityType=='cash'>
			                    		返现
			                    	<#elseif activity.activityType=='coupon'>
			                    		返劵
			                    	</#if>
		                    	<p>
		                    </div>
		                </div>
		                
		                <#if activity.activityType=='cash'>
		                	<div class="form-group">
			                    <label class="col-sm-3 control-label"><em>*</em>返现金额：</label>
			                    <div class="col-sm-3">
			                    	<p class="form-control-static">
			                    		${activity.money}元
			                    	<p>
			                    </div>
			                </div>		                
		                <#elseif activity.activityType=='coupon'>
                			<#if activity.activityCouponRules??>
                				<#list activity.activityCouponRules as activityCouponRules>
	                    			<div class="form-group">
		                    			<label class="col-sm-3 control-label"></label>
					                    <div class="col-sm-3">
					                    	<p class="form-control-static">
					                    		${activityCouponRules.couponRuleName} ： ${activityCouponRules.couponAmount}张
					                    	<p>
					                    </div>
				                    </div>
			                    </#list>
                			</#if>
                    	</#if>
                    	
                    	<div class="form-group">
		                    <label class="col-sm-3 control-label">订单类型：</label>
		                    <div class="col-sm-3">
		                    	<select class="form-control" id="orderType" name="orderType" disabled required/>
		                    		<option value="" >请选择</option>
		                    		<option value="daijia" <#if activity.orderType?? && activity.orderType=='daijia'>selected="selected"</#if>>代驾</option>
		                    		<option value="zhuanche" <#if activity.orderType?? && activity.orderType=='zhuanche'>selected="selected"</#if>>专车</option>
		                    		<option value="freight" <#if activity.orderType?? && activity.orderType=='freight'>selected="selected"</#if>>货运</option>
		                    		<option value="zhuanxian" <#if activity.orderType?? && activity.orderType=='zhuanxian'>selected="selected"</#if>>专线</option>
		                    	</select>
		                    </div>
		                </div>
		                
		                <div class="form-group">
		                    <label class="col-sm-3 control-label">每完成订单：</label>
		                    <div class="col-sm-3">
	                   			<div class="input-group">
			                    	<input class="form-control" id="completeTimes" name="completeTimes" value="<#if activity.completeTimes??>${activity.completeTimes}</#if>" type="number" disabled/>
			                    	<span class="input-group-addon">次</span>
			                    </div>
		                    </div>
		                </div>
		                
		                 <div class="form-group">
		                    <label class="col-sm-3 control-label"><em>*</em>限制参与：</label>
		                    <div class="col-sm-3">
		                    	<div class="input-group">
		                    		<input class="form-control" value="${activity.restriction}" id="restriction" name="restriction" type="number" disabled/>
		                    		<span class="input-group-addon">次</span>
			                    </div>
		                    </div>
		                     <label class="control-label"><em>0不限制参与次数</em></label>
		                </div>
		                
		                
		                
		                <div class="form-group">
		                    <label class="col-sm-3 control-label"><em>*</em>有效期：</label>
		                    <div class="col-sm-3">
		                    	<input class="form-control" id="start" name="start" type="text" value="${activity.startDate?string('yyyy-MM-dd')}" disabled/>
		                    	<span class="help-block">活动的开始时间，由该日期凌晨开始</span>
		                    </div>
		                    <label style="float:left;" class="control-label">-</label>
		                    <div class="col-sm-3">
		                    	<input class="form-control" id="end" name="end" type="text" <#if activity.endDate??>value="${activity.endDate?string('yyyy-MM-dd')}"</#if> <#if activity.timeStatus==2>disabled</#if>/>
		                   		<span class="help-block">活动的结束时间，由该日期凌晨结束，不填写则不限制结束时间</span>
		                    </div>
		                </div>
		               
		                <div class="form-group">
	    					<label class="col-sm-3 control-label">活动规则：</label>
	    					<div  class="col-sm-7">
	    						<textarea class="form-control" cols="40"  rows="5" id="activityContent" name="activityContent" required>${activity.activityContent?if_exists}</textarea>
	    					</div>
	    				</div>
	    				
		                
		                
		                
		                
		                
		                <div class="form-group">
		    					<label class="col-sm-3 control-label"><em>*</em>活动背景图片：</label>
		    					<div class="col-sm-6" >
									<input type="hidden" name="imgsUrl" id="imgsUrl" value="${activity.activityImage}"/>
									<div class="row">
										<div class="col-sm-6">
											<span class="help-block">建议图片大小1920x3000</span>
										</div>
									</div>
									<div class="tabbable"> 
										<ul class="nav nav-tabs">
										 	<li class="active"><a href="#tab1" id="show1" data-toggle="tab">系统内置</a></li>
										 	<li><a href="#tab2" id="show2" data-toggle="tab">自定义</a></li>
										</ul>
										
										<div class="tab-content">
											<div class="tab-pane fade in active" id="tab1">
													 <img class="img" name="hide" src="${ctx}/assets/img/phonegift_1.png" bath-src="assets/img/phonegift_1.png" id="phonegift_1" backgroud="#d41501" width="80" height="100" />
													 <img class="img" name="hide" src="${ctx}/assets/img/phonegift_2.jpg" bath-src="assets/img/phonegift_2.jpg" id="phonegift_2" backgroud="#8eafef" width="80" height="100"/>
													 <img class="img" name="hide" src="${ctx}/assets/img/phonegift_3.jpg" bath-src="assets/img/phonegift_3.jpg" id="phonegift_3" backgroud="#f53d47" width="80" height="100"/>
											</div>
											<div class="tab-pane fade" id="tab2">
												<div id="custom">
													<img src="${ctx}/assets/img/add2.png" id="shareImage_btn" width="80" height="100" style="display:none;"/>
													<img src="${ctx}/assets/img/add.png" id="shareImage_btn2"  width="80" height="100" />
													<#if activity.activityImage!="assets/img/phonegift_1.png" && activity.activityImage!="assets/img/phonegift_2.jpg" && activity.activityImage!="assets/img/phonegift_3.jpg">
													 	<img class="img" id="phonegift_4" backgroud="${activity.backgroudColor}" src="${ctx}/${activity.activityImage}" bath-src="${activity.activityImage}" width="80" height="100" style="border:2px solid red;"/>
													 </#if>
													<input style="display:none;" type="file" name="imgFile" id="activityImage"  accept=".bmp,.gif,.jpeg,.jpg,.png" />
												</div>
											</div>
										</div>
									</div>
								</div>
		    				</div>
				             
				             <div class="form-group" style="display:none;" id="backgroudColor_div">
			                    <label class="col-sm-3 control-label"><em>*</em>背景颜色：</label>
			                    <div class="col-sm-3">
			                    	<input name="backgroudColor" id="backgroudColor" class="form-control minicolors-input" value="${activity.backgroudColor}" onChange="backgroundColor(this.value)" type="text"/>
			                    </div>
			                </div>
			                
		                	<div class="form-group">
						    	<label class="col-sm-3 control-label">通知方式：</label>
			                	<div class="col-sm-3">
			                		<p class="form-control-static">
										<label style="padding-right:12px;">
										  <input type="checkbox" name="messageType" value="sms" <#if activity.messageType?? && activity.messageType?contains('sms')>checked="checked"</#if>/> 短信
										</label>
										<label style="padding-right:12px;">
										  <input type="checkbox" name="messageType" value="message" <#if activity.messageType?? && activity.messageType?contains('message')>checked="checked"</#if>/> 应用通知
										</label>
									</p>
								</div>
						    </div>
		                
		                
		                
		               
		                
		                <div class="form-group" style="margin-left:10px;">
		                	<label class="col-sm-3 control-label"></label>
			                <input id="submit_button" type="button" class="btn btn-primary" value="保存">
			                <input type="button" class="btn btn-default" onclick="window.location.href = '${ctx}/activity/list?event=phoneGift&type=${activity.activityType}';" value="返回">
			            </div>
					</form>
        		</div>
        	</div>
		</div>
	</div>
</div>

</@override>
<@override name="footer">
<script type="text/javascript">
	var main=false;
	<@shiro.isMainCompany>
		main=true;
	</@shiro.isMainCompany>
</script>
<script src="${ctx}/assets/kindeditor/kindeditor-all-min.js"></script>
<script src="${ctx}/assets/kindeditor/lang/zh_CN.js"></script>
<script src="${ctx}/assets/js/jquery.minicolors.min.js"></script>
<script src="${ctx}/assets/js/bootstrap-multiselect.js"></script>
<script src="${ctx}/assets/js/bootstrap-datetimepicker.min.js"></script>
<script src="${ctx}/assets/js/bootstrap-datetimepicker.zh-CN.js"></script>
<script src="${ctx}/assets/js/ajaxfileupload.js"></script>
<script src="${ctx}/assets/js/activity/editphonegift.js"></script>
</@override>
<@extends name="../layout.ftl"/>
